﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DataAccess;

namespace QUANLYKHACHSAN_N4
{
    public partial class frmThemSuaLoaiPhong : DevComponents.DotNetBar.Office2007Form
    {
        public frmThemSuaLoaiPhong()
        {
            InitializeComponent();
        }
        public string ten = "";
        public bool status = false;
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                if (ten == "")
                {

                    if (LoaiPhong_Info.Add(txtTenLoaiPhong.Text, decimal.Parse(txtGia.Text), int.Parse(txtSoNguoi.Text)))
                    {
                        status = true;
                        Close();
                    }
                    return;
                }
                else
                {
                    if (LoaiPhong_Info.Update(ten,txtTenLoaiPhong.Text, decimal.Parse(txtGia.Text), int.Parse(txtSoNguoi.Text)))
                    {
                        status = true;
                        Close();
                    }
                }
                return;
            }
            catch
            {
                BatLoi.DgResult("Du lieu nhap vao chua dung vui long kiem tra lai");
            }
            this.Close();
        }

        private void frmThemSuaLoaiPhong_Load(object sender, EventArgs e)
        {
            
            ten = "";

        }
    }
}
